package org.wingstudio.util;

import java.io.File;

public class DocumentPreviewTest {

	public void preview(String path2,String fileName){
		try {
			//是tomcat的目录
			String path = System.getProperty("user.dir");
			System.out.println(path);
			//String folder = path + "/src/main/webapp/static/test/java.doc";
			//String filePath = request.getSession().getServletContext().getRealPath("/static");
			String pdfFolder = path + "/pdf/";
			//System.out.println("test filePath:"+filePath);

			// 方案一:
			//System.out.println("转换后存放的文件:"+path);
			String folder=path+"/test/test.doc";
			File swf = DocumentConverterUtil.conver(folder, pdfFolder, false, false);
			// 方案二:
			//File swf = org.tangjl.utill.jacob.DocumentConverterUtil.conver("key", folder, pdfFolder, swfFolder, false, false);
			//System.out.println("转换成功");
			// 文件链接
			/*String finalFilePath = null;
			if (null != swf) {
				finalFilePath = swfFolder + swf.getName();
			}
			System.out.println("转换后文件路径:" + finalFilePath);*/
		} catch (Exception e) {
			System.out.println("test fileconvert");
			if (e.getClass() == RuntimeException.class) {
				System.out.println(e.getMessage());
			}
			e.printStackTrace();
		}
	}
}
